<template>
  <div>
    <h3>管理界面</h3>
    <el-table :data="cutObj.records" style="width: 100%" border="1">
      <el-table-column prop="id" label="订单号"  />
      <el-table-column prop="totalPrice" label="订单总价" />
      <el-table-column prop="status" label="订单状态" />
      <el-table-column prop="orderDate" label="下单时间" />
      <el-table-column fixed="right" label="订单详情" width="">
        <template #default="scope">
          <el-button link type="primary" size="small" @click="gotoOrderDetail(scope.row)">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
        v-model:current-page="cutObj.current"
        v-model:page-size="cutObj.size"
        background
        layout="prev, pager, next, jumper"
        :total="cutObj.total"
        @current-change="cutByItem"
    />

    <el-row>
      <el-col :spm="16"></el-col>
      <el-col :spm="8">
        <el-row>
          <el-col :span="8"> 订单状态:<el-col :span="16"></el-col>
          <el-select v-model="findObj.status" placeholder="Select">
            <el-option
                v-for="item in options"
                :key="item"
                :label="item"
                :value="item"
            />
          </el-select>
          </el-col>

          <el-col :span="8"> 起始日期<el-col :span="16"></el-col>
            <el-input v-model="findObj.startDate"></el-input><br>
          </el-col>
          <el-col :span="8"> 结束日期<el-col :span="16"></el-col>
            <el-input v-model="findObj.endDate"></el-input><br>
          </el-col>
          <el-button type="primary" @click="cutByItem(1)">查询</el-button>
        </el-row>

      </el-col>
    </el-row>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      findObj:{},
      cutObj:{},
      options:['不限','未发货','发货中','已完结']
    }
  },methods:{
    cutByItem(pageNO){
      this.findObj.pageNO=pageNO;
      axios.get("/project/order/cutByItem",{params:this.findObj}).then(resp=> {
        this.cutObj = resp.data;
      });
    },gotoOrderDetail(orderObj){
    //封装 对象转字符串
    sessionStorage.setItem("orderBean",JSON.stringify(orderObj));
    //跳转
    this.$router.push('/orderDetail2')
  }
},created() {
    this.cutByItem(1);
  }
}
</script>

<style scoped>

</style>